package com.warehouse.module.business.service.worldCityCode;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.warehouse.module.business.controller.admin.worldCityCode.vo.WorldCityCodeReqVO;
import com.warehouse.module.business.dal.dataobject.worldCityCode.WorldCityCodeDO;
import com.warehouse.module.business.dal.mysql.worldCityCode.WorldCityCodeMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;
import java.util.List;

@Service
@Validated
public class WorldCityCodeServiceImpl implements WorldCityCodeService{
    @Resource
    private WorldCityCodeMapper worldCityCodeMapper;


    @Override
    public List<WorldCityCodeDO> listWordCode(WorldCityCodeReqVO vo) {
        return worldCityCodeMapper.listWordCode(vo);
    }

    @Override
    public WorldCityCodeDO getByCode(String code){
        LambdaQueryWrapper<WorldCityCodeDO> query = Wrappers.lambdaQuery(WorldCityCodeDO.class)
                .eq(WorldCityCodeDO::getCode, code);
        return worldCityCodeMapper.selectOne(query);
    }
}
